<template>
  <view class="container">
    <!-- 顶部标题 -->
    <view class="header fade-in">
      <!-- <view class="icon-wrapper">
        <uni-icons type="compose" size="30" color="#005FE3" />
      </view> -->
      <view class="title">正在进行专业估值</view>
      <view class="subtitle">请稍候，我们正在分析市场数据...</view>
    </view>

    <!-- 加载动画卡片 -->
    <view class="card fade-in">
      <view class="loader">
        <view class="spin-outer spin-reverse"></view>
        <view class="spin-inner pulse"></view>
        <text class="fa fa-billiard-ball icon-spin spin-slow"></text>
      </view>

      <!-- 进度条 -->
      <view class="progress-section">
        <view class="progress-info">
          <text class="label">估值进度</text>
          <text class="percent">{{ progress }}%</text>
        </view>
        <view class="progress-bar-bg">
          <view class="progress-bar" :style="{ width: progress + '%' }"></view>
        </view>
      </view>

      <!-- 估值步骤 -->
      <view class="steps">
        <view v-for="(step, index) in steps" :key="index" class="step">
          <!-- <view class="step-circle" :class="step.status"> -->
            <!-- <text :class="step.icon"></text> -->
            <!-- <uni-icons :type="step.icon" size="20" color="#005FE3" /> -->
            <uni-icons :type="step.icon" size="20" color="#005FE3" />
        <!-- </view> -->
          <text class="step-label" :class="step.status">{{ step.label }}</text>
        </view>
      </view>
    </view>

    <!-- 分析详情 -->
    <!-- <view class="analysis fade-in">
      <view v-for="(item, i) in analysisList" :key="i" class="analysis-card" :class="{ done: item.done, active: item.active }">
        <view class="left">
          <view class="icon-bg">
            <text :class="item.icon"></text>
          </view>
          <view class="info">
            <text class="title">{{ item.title }}</text>
            <text class="desc">{{ item.desc }}</text>
          </view>
        </view>
        <view class="right">
          <view class="icon-bg">
            <text :class="item.statusIcon"></text>
          </view>
        </view>
      </view>
    </view> -->

    <!-- 提示卡片 -->
    <view class="tip fade-in analysis-card">
      <view  class="icon-bgs">
        <uni-icons type="info-filled" size="20" color="#005FE3" />
      </view>
      <view class="tip-text">
        <view class="tip-title">估值提示</view>
        <view class="tip-desc">估值时间可能因市场数据波动而略有延长，感谢您的耐心等待。</view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      progress: 35,
      steps: [
        { label: '数据收集', icon: 'checkbox-filled', status: 'done' },
        { label: '市场分析', icon: 'refresh-filled', status: 'active' },
        { label: '生成结果', icon: 'navigate-filled', status: 'pending' },
      ],
      analysisList: [
        {
          title: '价格趋势分析',
          desc: '评估市场价格波动',
          icon: 'fa fa-line-chart',
          statusIcon: 'fa fa-check',
          active: false,
          done: true
        },
        {
          title: '品牌价值评估',
          desc: '分析品牌影响力',
          icon: 'fa fa-trophy',
          statusIcon: 'fa fa-refresh spin-slow',
          active: true,
          done: false
        },
        {
          title: '供需关系分析',
          desc: '评估市场流通性',
          icon: 'fa fa-users',
          statusIcon: 'fa fa-clock-o',
          active: false,
          done: false
        }
      ]
    }
  },
  mounted() {
    this.startProgress();
  },
  methods: {
    startProgress() {
      const interval = setInterval(() => {
        if (this.progress < 99) {
          this.progress += Math.random() * 3;
            this.progress = Math.min(Math.round(this.progress), 99);          this.updateStatus();
        } else {
          clearInterval(interval);
        }
      }, 300);
    },
    updateStatus() {
      const thresholds = [25, 50, 75];
      this.analysisList.forEach((item, index) => {
        item.done = this.progress >= thresholds[index] + 15;
        item.active = this.progress >= thresholds[index] && !item.done;
      });
    }
  }
}
</script>

<style scoped>
/* 全局样式 */
@import url("./index.css");

.container {
  padding: 16px;
  /* padding-top: 323px; */
  background: linear-gradient(to bottom, #f5f7fa, #fff);
  min-height: 100vh;
  font-family: sans-serif;
  color: #333;
}

.fade-in {
  animation: fadeIn 0.5s ease-out forwards;
}

.card {
  background: #fff;
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 15px rgba(0, 95, 227, 0.08);
}
.header {
  margin: auto;
  width: 371rpx;
  text-align: center;
  margin-bottom: 20px;
}

.header .icon {
  font-size: 24px;
  color: #005FE3;
}

.title {
  font-weight: bold;
  font-size: 20px;
  color: #005FE3;
}

.subtitle {
  font-size: 12px;
  color: #666;
}

.loader {
  position: relative;
  height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spin-outer, .spin-inner {
  position: absolute;
  width: 128px;
  height: 128px;
  border-radius: 50%;
  border: 4px solid rgba(0, 95, 227, 0.1);
}

.spin-inner {
  width: 104px;
  height: 104px;
  border-color: rgba(0, 95, 227, 0.2);
  animation: pulse 1.5s infinite;
}

.icon-spin {
  font-size: 48px;
  color: #005FE3;
  z-index: 1;
}

.spin-slow {
  animation: spin 3s linear infinite;
}

.spin-reverse {
  animation: spin 4s linear infinite reverse;
}

.progress-section {
  margin-top: 16px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #666;
}

.progress-bar-bg {
  background: #e6e9ef;
  border-radius: 999px;
  overflow: hidden;
  height: 8px;
  margin-top: 4px;
}

.progress-bar {
  height: 8px;
  background: linear-gradient(135deg, #005FE3 0%, #007AFF 100%);
  border-radius: 999px;
  transition: width 0.5s ease-out;
}

.steps {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
}

.step {
  text-align: center;
  flex: 1;
    align-items: center;
    display: flex;
}

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  margin: 0 auto 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-label {
  font-size: 12px;
}

.done {
  color: #005FE3;
}

.active {
  color: #005FE3;
}

.pending {
  color: #999;
}

.hint-text {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin-top: 12px;
}

.highlight {
  color: #005FE3;
  font-weight: bold;
}

.analysis-card {
  background: #fff;
  border-radius: 12px;
  padding: 16px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  opacity: 0.7;
  transition: all 0.3s ease;
}
.icon-bgs{
  height: 40px;
  width: 67px;
  border-radius: 50%;
  background-color: rgb(223, 230, 247);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}
.analysis-card.done,
.analysis-card.active {
  opacity: 1;
}

.analysis-card .icon-bg {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #f0f4fb;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 12px;
}

.analysis-card .info .title {
  font-size: 14px;
  font-weight: bold;
  margin-bottom: 2px;
}

.analysis-card .info .desc {
  font-size: 12px;
  color: #999;
}

.tip {
  background-color: rgba(0, 95, 227, 0.05);
  padding: 12px;
  border-radius: 12px;
  display: flex;
  margin-bottom: 32px;
}

.tip-icon {
  background: rgba(0, 95, 227, 0.1);
  padding: 8px;
  border-radius: 50%;
  margin-right: 12px;
}

.tip-title {
  color: #005FE3;
  font-size: 14px;
  font-weight: bold;
}

.tip-desc {
  font-size: 12px;
  color: #666;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.05); opacity: 0.7; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
</style>
